<template>
	<van-tabs v-model:active="active" @change="onTabChange">
		<van-tab :title="item.name" v-for="(item,index) in dataList" :key="index"></van-tab>
	</van-tabs>
</template>

<script>
	import utils from '@/utils/utils.js';
	import {
		sendComponentEventRequest
	} from '@/utils/requestUtils.js';
	export default {
		name: "FilterGroupComponent",
		props: ["componentModel"],
		inject: ['children'],
		data() {
			return {
				active: 0,
				dataList: []
			}
		},
		mounted() {
			this.children.push(this);
		},
		beforeUnmount() {
			utils.removeArrayElement(this.children, this);
		},
		methods: {
			setProp(prop) {
				if (prop["data"] != undefined) {
					this.dataList = prop["data"];
				}
			},
			onTabChange() {
				var data = {};
				data[this.componentModel.id + "_active"] = this.active;
				sendComponentEventRequest(this, "selectedChangeEvent", data);
			}
		},
	}
</script>

<style>
</style>
